
<%@ page import="net.tribal.comic.entities.Page" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />

        <title><g:message code="default.label.best.pages.nav"/></title>
    </head>
    
    <body>
	    <div class="navButtonsTop rounded-corners">
			<h1 class="title"><g:message code="default.label.best.pages" args="[title]"/></h1>
		</div>
		
		<div class="element rounded-corners">
			<g:if test="${instanceList}">
				<g:if test="${session.pageViewMode == 'flow'}">
					<div class="scroll rounded-corners">
	  					<g:each in="${instanceList}" var="instance">
					    	<div class="item ${instance.disabled ? 'disableItem' : ''}">
					    		<img class="portada" src="${resource(file:instance?.pathFileThumbnail)}" />
					    	
					    		<div class="resumen">
									<label>${instance.title}</label>
								</div>
								
								
							</div>
						</g:each>
					</div>
				</g:if>
	
				<g:if test="${session.pageViewMode == 'list'}">
					<div class="tableList rounded-corners">
						<table>
				        	<thead>
				            	<tr>
				            		<th><g:message code="default.label.actions"/></th>
				            		<usr:isAdmin>
										<g:sortableColumn property="id" titleKey="default.label.id" params="['fromId':fromId]"/>
										<g:sortableColumn property="disabled" titleKey="default.label.disabled" params="['fromId':fromId]"/>
									</usr:isAdmin>
				               	    <g:sortableColumn property="title" titleKey="default.label.title" params="['fromId':fromId]"/>
				               	    <th><g:message code="default.label.createdBy"/></th>
								</tr>
							</thead>
							<tbody>
				            	<g:each in="${instanceList}" status="i" var="instance">
				                	<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
				                        <td><g:link action="show" id="${instance.id}"><g:message code="default.label.show"/></g:link></td>
				                        <usr:isAdmin>
					                        <td>${fieldValue(bean:instance, field: "id")}</td>
					                        <td><g:formatBoolean boolean="${instance.disabled}" /></td>
				                        </usr:isAdmin>
				                        <td>${fieldValue(bean:instance, field: "title")}</td>
				                        <td>${fieldValue(bean:instance, field: "createdBy.alias")}</td>
				                    </tr>
				                </g:each>
							</tbody>
						</table>
					</div>
				</g:if>
			</g:if>
	
			<g:else>
				<div class="noData rounded-corners">
					<g:message code="default.no.pages"/>
				</div>
			</g:else>
		</div>
		
		<div class="paginateButtons rounded-corners">
			<div class="left">
				<g:paginate total="${instanceTotal}" params="['fromId':fromId]"/>
			</div>
		</div>
    </body>
</html>
